package com.whd.strategy.b_main;


import com.whd.strategy.c_okWtite.Cashback;
import com.whd.strategy.c_okWtite.Count;
import com.whd.strategy.c_okWtite.Discount;


import java.util.Scanner;

/**
 * @author whd
 * @date 2024/07/18 17:16:38
 */
public class Demo {

    /*
    * 算简单工程模式感觉
    * */
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        System.out.println("请输入单价（单位分）");
        Long money = sc.nextLong();
        System.out.println("请输入购买量");
        int count = sc.nextInt();
        System.out.println("1.打五折");
        System.out.println("2.每满100元减30元");
        System.out.println("请输入收款模式");
        int num = sc.nextInt();
        Count cashback;
        switch (num) {
            case 1:
                cashback = new Discount(0.5);
                break;
            case 2:
                cashback = new Cashback(100, 30);
                break;
            default:
                throw new RuntimeException("输入收款模式有误");
        }
        // Long sum = new Count().sum(money, count);
        Long sum = cashback.sum(money, count);
        System.out.println("一共花费" + (sum / 100) + "元");
        sc.close();
    }
}
